import request from '@/utils/request'

// 查询流程模型信息
export function listModel(query) {
  return request({
    url: '/workflow/model/list',
    method: 'get',
    params: query
  })
}

export function listAppModel(query) {
  return request({
    url: '/workflow/model/listByAppId',
    method: 'get',
    params: query
  })
  // return request({
  //   url: '/workflow/model/list/' + appId,
  //   method: 'get',
  // })
}

// 查询流程模型信息
export function historyModel(query) {
  return request({
    url: '/workflow/model/historyList',
    method: 'get',
    params: query
  })
}

export function getModel(modelId) {
  return request({
    url: '/workflow/model/' + modelId,
    method: 'get'
  })
}

// 新增模型信息
export function addModel(data) {
  return request({
    url: '/workflow/model',
    method: 'post',
    data: data
  })
}

// 修改模型信息
export function updateModel(data) {
  return request({
    url: '/workflow/model',
    method: 'put',
    data: data
  })
}

// 保存流程模型
export function saveModel(data) {
  return request({
    url: '/workflow/model/save',
    method: 'post',
    data: data
  })
}

export function latestModel(params) {
  return request({
    url: '/workflow/model/latest',
    method: 'post',
    params: params
  })
}

export function delModel(modelIds) {
  return request({
    url: '/workflow/model/' + modelIds,
    method: 'delete'
  })
}

export function deployModel(params) {
  return request({
    url: '/workflow/model/deploy',
    method: 'post',
    params: params
  })
}

// 获取流程模型流程图
export function getBpmnXml(modelId) {
  return request({
    url: '/workflow/model/bpmnXml/' + modelId,
    method: 'get'
  })
}

export function appProcessFormset(data) {
  return request({
    url: '/app/appProcessFormset',
    method: 'post',
    data
  })
}
export function getListByTaskId(params) {
  return request({
    url: '/app/appProcessFormset/getListByTaskId',
    method: 'get',
    params
  })
}

export function saveOrUpdateForProcess(insId,data) {
  return request({
    url: `/frontView/form/saveOrUpdateForProcess/${insId}`,
    method: 'post',
    data
  })
}


export function saveNodeInterface(data) {
  return request({
    url: `/app/appProcessExtapi`,
    method: 'post',
    data
  })
}

export function getNodeInterface(params) {
  return request({
    url: `/app/appProcessExtapi/list`,
    method: 'get',
    params
  })
}

export function appProcessStartRole(params) {
  return request({
    url: `/app/appProcessStart`,
    method: 'post',
    data:params
  })
}

export function getAppProcessStartRole(params) {
  return request({
    url: `/app/appProcessStart/list`,
    method: 'get',
    params
  })
}

export function saveAppProcessTitleConfig(params) {
  return request({
    url: `/app/appProcessTitleConfig`,
    method: 'post',
    data:params
  })
}

export function getAppProcessTitleConfig(params) {
  return request({
    url: `/app/appProcessTitleConfig/list`,
    method: 'get',
    params
  })
}

export function getNextTaskCopyUser(params) {
  return request({
    url: `/workflow/process/getNextTaskCopyUser`,
    method: 'get',
    params
  })
}

export function processBottomDisplayDelete(ids) {
  return request({
    url: `/app/processBottomDisplay/${ids}`,
    method: 'delete',
  })
}

export function getTaskCandidate(params) {
  return request({
    url: `/workflow/process/getTaskCandidate`,
    method: 'get',
    params
  })
}

export function getProcessRoute(id) {
  return request({
    url: `/processRoute/get/${id}`,
    method: 'get',
  })
}

export function saveProcessRoute(data) {
  return request({
    url: `/processRoute/save`,
    method: 'post',
    data
  })
}

export function getTagList() {
  return request({
    url: `/userCommonPhrases/list`,
    method: 'get',
  })
}

export function saveTagList(data) {
  return request({
    url: `/userCommonPhrases/reset`,
    method: 'post',
    data
  })
}

export function cronModelDetail(modelId) {
  return request({
    url: `/cronModel/info/${modelId}`,
    method: 'get',
  })
}

export function settingCronModel(data) {
  return request({
    url: `/cronModel/setting`,
    method: 'post',
    data
  })
}



